const _import =
  process.env.NODE_ENV === 'production'
    ? (file) => () => import('@/views/' + file + '.vue')
    : (file) => require('@/views/' + file + '.vue').default

export default [
  {
    path: '404',
    component: _import('common/404'),
    name: '404',
    meta: { title: '页面不存在' },
    beforeEnter(to, from, next) {
      if (from.name === null) {
        next({ name: 'main' })
      } else {
        next()
      }
    }
  },
  {
    path: 'refresh',
    component: _import('common/refresh'),
    name: 'refresh',
    meta: { title: '刷新页面' }
  },
  {
    path: 'noPermission',
    component: _import('common/noPermission'),
    name: 'noPermission',
    meta: { title: '无页面权限' },
    beforeEnter(to, from, next) {
      if (from.name === null) {
        next({ name: 'main' })
      } else {
        next()
      }
    }
  }
]
